#! /bin/bash
Tumor=$1

curDir="${Titan_path}/optimalClusterSolution_NonTumor/${Tumor}_titanCNA_result"
input="${Titan_path}/optimalClusterSolution_NonTumor/${Tumor}_optimalClusterSolution.txt"

for i in `cut -f11 ${input} | grep -v "path"`;
do
	echo -e "Copying $curDir/${i} to ${curDir}"
	mkdir -p ${curDir}
	ln -snf ${i}.ichor.cna.txt ${curDir}/
	ln -snf ${i}.ichor.seg.txt ${curDir}/
	ln -snf ${i}.params.txt ${curDir}/
	ln -snf ${i}.seg ${curDir}/
	ln -snf ${i}.segs.txt ${curDir}/
	ln -snf ${i}.txt ${curDir}/

done	

## CNV,LOH的PDF连接过去
phi=`cat ${input} | grep -v path | awk -F'\t' '{print $1}'`
cluster=`cat ${input} | grep -v path | awk -F'\t' '{print $2}'`
sample=`cat ${input} | grep -v path | awk -F'\t' '{print $3}'`

ln -snf ${Titan_path}/CNAPlot_NonTumor/${sample}_titanCNA_ploidy${phi}/${sample}_${cluster} ${curDir}

